

<%@ page import="com.surelution.projects.congress.Member" %>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <meta name="layout" content="main" />
        <g:set var="entityName" value="${message(code: 'member.label', default: '委员')}" />
        <title>新建代表</title>
    </head>
    <body>
        <div class="nav">
            <span class="menuButton"><a class="home" href="${createLink(uri: '/')}"><g:message code="default.home.label"/></a></span>
            <span class="menuButton"><g:link class="list" action="list"><g:message code="default.list.label" args="[entityName]" /></g:link></span>
        </div>
        <div class="body">
            <h1>代表增选</h1>
            <g:if test="${flash.message}">
            <div class="message">${flash.message}</div>
            </g:if>
            <g:hasErrors bean="${memberInstance}">
            <div class="errors">
                <g:renderErrors bean="${memberInstance}" as="list" />
            </div>
            </g:hasErrors>
            <g:uploadForm action="save" >
                <div class="dialog">
                    <table>
                        <tbody>
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="name"><g:message code="member.name.label" default="Name" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: memberInstance, field: 'name', 'errors')}">
                                    <g:textField name="name" value="${memberInstance?.name}" />
                                </td>
                            </tr>

                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="picture"><g:message code="member.picture.label" default="Picture" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: memberInstance, field: 'picture', 'errors')}">
                                    <g:field type="file" name="picture"/>
                                </td>
                            </tr>

                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="memberGroup"><g:message code="member.memberGroup.label" default="Member Group" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: memberInstance, field: 'memberGroup', 'errors')}">
                                    <g:select name="memberGroup.id" from="${com.surelution.projects.congress.MemberGroup.list()}" optionKey="id" optionValue="title" value="${memberInstance?.memberGroup?.id}"  />
                                </td>
                            </tr>

                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="party"><g:message code="member.party.label" default="Party" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: memberInstance, field: 'party', 'errors')}">
                                    <g:select name="party.id" from="${com.surelution.projects.congress.Party.list()}" optionKey="id" optionValue="title" value="${memberInstance?.party?.id}"  />
                                </td>
                            </tr>

                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="nation"><g:message code="member.nation.label" default="Nation" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: memberInstance, field: 'nation', 'errors')}">
                                    <g:select name="nation.id" from="${com.surelution.projects.congress.Nation.list()}" optionKey="id" optionValue="title" value="${memberInstance?.nation?.id}"  />
                                </td>
                            </tr>
                            
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="level"><g:message code="member.level.label" default="Level" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: memberInstance, field: 'level', 'errors')}">
                                    <g:select name="level" from="${com.surelution.projects.congress.MemberLevel?.values()}" optionValue="title" keys="${com.surelution.projects.congress.MemberLevel?.values()*.name()}" value="${memberInstance?.level?.name()}"  />
                                </td>
                            </tr>                        


                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="gender"><g:message code="member.gender.label" default="Gender" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: memberInstance, field: 'gender', 'errors')}">
                                    <g:select name="gender" from="${com.surelution.projects.congress.Gender?.values()}" optionValue="title" keys="${com.surelution.projects.congress.Gender?.values()*.name()}" value="${memberInstance?.gender?.id}"  />
                                </td>
                            </tr>

                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="title"><g:message code="member.title.label" default="Title" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: memberInstance, field: 'title', 'errors')}">
                                    <g:select name="title.id" from="${com.surelution.projects.congress.JobTitle.list()}" optionKey="id" optionValue="title" value="${memberInstance?.title?.id}"  />
                                </td>
                            </tr>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="mobileNumber"><g:message code="member.mobileNumber.label" default="Mobile Number" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: memberInstance, field: 'mobileNumber', 'errors')}">
                                    <g:textField name="mobileNumber" value="${memberInstance?.mobileNumber}" />
                                </td>
                            </tr>
                        
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="passportId"><g:message code="member.passportId.label" default="Passport Id" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: memberInstance, field: 'passportId', 'errors')}">
                                    <g:textField name="passportId" value="${memberInstance?.passportId}" />
                                </td>
                            </tr>
                        
                            <tr class="prop">
                                <td valign="top" class="name">
                                  <label for="workOrganization"><g:message code="member.workOrganization.label" default="Work Organization" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: memberInstance, field: 'workOrganization', 'errors')}">
                                    <g:textField name="workOrganization" value="${memberInstance?.workOrganization}" />
                                </td>
                            </tr>
                                                
                            <tr class="prop">
                                <td valign="top" class="name">
                                  <label for="address"><g:message code="member.address.label" default="Address" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: memberInstance, field: 'address', 'errors')}">
                                    <g:textField name="address" value="${memberInstance?.address}" />
                                </td>
                            </tr>

                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="extrolTel"><g:message code="member.extrolTel.label" default="Extrol Tel" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: memberInstance, field: 'extrolTel', 'errors')}">
                                    <g:textField name="extrolTel" value="${memberInstance?.extrolTel}" />
                                </td>
                            </tr>

                            <tr class="prop">
                                <td valign="top" class="name">
                                    <label for="startDate"><g:message code="member.startDate.label" default="Start Date" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: memberInstance, field: 'startDate', 'errors')}">
                                    <g:datePicker name="startDate" value="${memberInstance?.startDate}" precision="day" />
                                </td>
                            </tr>
                        
                        </tbody>
                    </table>
                </div>
                <div class="buttons">
                    <span class="button"><g:submitButton name="create" class="save" value="增选" /></span>
                </div>
            </g:uploadForm>
        </div>
    </body>
</html>
